# coding:UTF-8
# ________________________
# Project_Name:pyzidonghua
# File_Name:Administrator
# Author:Administrator
# Date_Time:2022/4/20 15:43
# Description:
# ________________________
from selenium import webdriver
import time


def  foo1():
    #打开浏览器
    driver=webdriver.Chrome()
    time.sleep(1)

    #最大化浏览器
    driver.maximize_window()

    #浏览器打开指定url
    driver.get("https://www.baidu.com")
    time.sleep(1)

    #浏览器后退
    driver.back()
    time.sleep(1)

    #浏览器向前
    driver.forward()
    time.sleep(1)

    #刷新浏览器
    driver.refresh()
    time.sleep(1)

    # 获取网页标题
    title = driver.title

    # 获取网页url
    url = driver.current_url
    print(f'网页标题:{title},网页地址:{url}')

    #关闭浏览器
    # driver.close()  #关闭当前浏览器
    driver.quit()   #关闭浏览器





if __name__ == "__main__":
    foo1()